package com.guowen.myaccount.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.guowen.myaccount.db.AccManageBean;
import com.guowen.myaccount.db.AccountBean;

import java.util.List;
import com.guowen.myaccount.R;

public class AccManagementAdapter extends BaseAdapter {

    private Context context;
    private List<AccManageBean> mDatas;

    public AccManagementAdapter(Context context, List<AccManageBean> mDatas) {
        this.context = context;
        this.mDatas = mDatas;
    }
    @Override
    public int getCount() {
        return mDatas.size();
    }

    @Override
    public Object getItem(int position) {
        return mDatas.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = LayoutInflater.from(context).inflate(R.layout.item_accmana_lv,parent, false);
        ViewHolder holder = new ViewHolder(convertView);
        AccManageBean accManageBean = mDatas.get(position);
        holder.titleTv.setText(accManageBean.getTypename());
        holder.beizhuTv.setText(accManageBean.getBeizhu());
        holder.moneyTv.setText(accManageBean.getMoney()+"");

        return convertView;
    }

    class ViewHolder{
        private TextView titleTv, beizhuTv, moneyTv;

        public ViewHolder(View view){
            titleTv = view.findViewById(R.id.item_accmana_lv_title);
            beizhuTv = view.findViewById(R.id.item_accmana_lv_beizhu);
            moneyTv = view.findViewById(R.id.item_accmana_lv_money);
        }

    }
}
